/* caprivate.h
 *
 * private defines for the conartist library.
 */

#ifndef CAPRIVATE_H
#define CAPRIVATE_H

#include <apr.h>
#include <apr_dso.h>

#include <libxml/tree.h>

#include "conartist.h"

struct caGenerator;
struct caStore;
struct caDir;
struct caURIMap;
struct caPipeline;
struct pipeData;
struct caMapStore;

extern apr_pool_t  *globalPool;   /* the global pool for memory allocations */
apr_table_t *libConfig;           /**< top level configuration */

apr_status_t dsoInit(void);
apr_status_t genInit(void);
apr_status_t storeInit(void);
apr_status_t pipeInit(void);
apr_status_t logInit(void);

apr_status_t addPipeModule(apr_dso_handle_t *, struct caModule *);
apr_status_t addStoreModule(apr_dso_handle_t *, struct caModule *);

apr_status_t checkDirectory(const char *, int);
apr_status_t caRecurseCheckDirectory(const char *, const char *);

apr_status_t caStoreFind(struct caStore **, const char *);

apr_status_t caGeneratorProcessRequest(struct caGenerator *, 
                                       struct caContent *);
apr_status_t caGeneratorOpenDir(struct caDir **thedir,
                                      const char *path, 
                                      struct caGenerator *gen);
apr_status_t caGeneratorCheckCache(struct caGenerator *);
apr_status_t caGeneratorAddMap(struct caURIMap *, struct caGenerator *);

apr_status_t caPipelineRegister(struct caPipeline *, const char *);
apr_status_t caPipeDataCreate(struct pipeData **, const char *, xmlNode *);
apr_status_t caPipelineAddPipeData(struct caPipeline *, struct pipeData *);

apr_status_t caFileWrite(const char *, const char *, apr_size_t);

void cavLog(int lvl, const char *fmt, va_list args);

apr_status_t caMapStoreCreate(struct caMapStore **, apr_pool_t *);
char *mapOutputFilename(struct caURIMap *, const char *, apr_pool_t *);
struct caURIMap *caGeneratorFindMap(struct caGenerator *, const char *);
apr_status_t cloneURIMap(struct caURIMap **, struct caURIMap *,
                         struct caGenerator *, const char *, const char *);

#endif /* CAPRIVATE_H */
